package com.kool.kadmin.system.constant;

import lombok.Getter;

import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author luyu
 */
@Getter
public enum MsgTypeEnum {
    REPAIR_MSG(1, "维修通知"),
    WARNING_MSG(2, "系统告警"),
    TASK_MSG(3, "定时任务通知"),
    DEV_MSG(4, "项目通知");

    Integer code;
    String desc;

    MsgTypeEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static Map<Integer, MsgTypeEnum> codeToEnum = Stream.of(MsgTypeEnum.values()).collect(Collectors.toMap(MsgTypeEnum::getCode, self -> self));

    public static MsgTypeEnum getByCode(Integer code) {
        return codeToEnum.get(code);
    }
}
